package com.design.pattern.flyweight.jdk;

/**
 * @version 1.0
 * @author: CRM_SYSTEM
 * @date: 2022/10/18 22:45
 * @Description:
 */
public class StringTest {
    public static void main(String[] args) {
        String s1="hello";
        String s2="hello";
        String s3="he"+"llo";
        String s4="he"+new String("llo");
        String s5=new String("hello");
        String s6= s5.intern();

        String s7="he";
        String s8="llo";
        String s9=s7+s8;
        System.out.println(s1==s3);
        System.out.println(s1==s4);
        System.out.println(s1==s5);
        System.out.println(s4==s5);
        System.out.println(s1==s6);
        System.out.println(s1==s9);
    }
}
